import pandas as pd


# 求单个数值占整个序列数值之和的比重
def get_proportion(normal_dataframe):
    proportion_df = pd.DataFrame(columns=normal_dataframe.columns, index=normal_dataframe.index)
    for column in normal_dataframe.columns:
        sigma_xij = sum(normal_dataframe[column])
        proportion_df[column] = normal_dataframe[column].apply(
            lambda x_ij: x_ij / sigma_xij if x_ij / sigma_xij != 0 else 1e-6)
    print('-----------占比-----------')
    print(proportion_df)
    return proportion_df
